/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package restauranteaplicacion.Modificaciones;

import restauranteaplicacion.Ingresos.*;
import Clases.Observador;
import Clases.ComboBox;
import CapaNegocios.CNOrden;
import java.util.List;
import entidad.Orden;
import java.awt.Component;
import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JOptionPane;
import restauranteaplicacion.MDI;
import entidad.Detalleorden;
import java.awt.Cursor;
import java.awt.event.KeyEvent;
import CapaNegocios.CNUsuarios;
import Clases.Impresora;
import entidad.Usuarios;
import java.net.URL;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;
import Reportes.clases.CorteDelDia;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Victor
 */
public class ModificacionComandas extends javax.swing.JInternalFrame implements Observer, Runnable{

    /**
     * Creates new form IngresoEmpleado
     */
    Observador obs;
    Thread hilo;
    //DefaultTableModel modelo;
    @SuppressWarnings("empty-statement")
    public ModificacionComandas() {
        initComponents();
        hilo= new Thread(this);
        obs=new Observador();
        obs.addObserver(this);        
        hilo.start();
        cmMesero.addItem(new ComboBox(0,"Todos"));
        cargarMeseros();
        cmMesero.setSelectedIndex(0);
    }
    


    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        ordenList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(new java.util.ArrayList());
        orden1 = new entidad.Orden();
        detalleordenList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(new java.util.ArrayList());
        detalleorden1 = new entidad.Detalleorden();
        jPanel1 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLayeredPane3 = new javax.swing.JLayeredPane();
        jScrollPane2 = new javax.swing.JScrollPane();
        Tabla = new javax.swing.JTable();
        txtNoOrden = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        btnAgregar = new javax.swing.JButton();
        btnModificar = new javax.swing.JButton();
        btnEliminar = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        dateFecha2 = new com.toedter.calendar.JDateChooser();
        btnBuscarFecha = new javax.swing.JButton();
        btnBuscarOrden = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel23 = new javax.swing.JLabel();
        btnCancelar = new javax.swing.JButton();
        dateFecha1 = new com.toedter.calendar.JDateChooser();
        cmMesero = new javax.swing.JComboBox();
        btnBuscarMesero = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        lbTotal = new javax.swing.JLabel();
        lbPropina = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        lbTarjeta = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        lbEfectivo = new javax.swing.JLabel();
        cmbSeleccion = new javax.swing.JComboBox();
        jLabel24 = new javax.swing.JLabel();
        btnCancelar1 = new javax.swing.JButton();

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.activo}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("activo"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.cortesia}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("cortesia"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.descuento}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("descuento"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.detalleordenCollection}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("detalleordenCollection"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.deudaCollection}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("deudaCollection"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.fecha}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("fecha"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.granTotal}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("granTotal"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.idOrden}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("idOrden"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.mesaidMesa}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("mesaidMesa"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.minutosEspera}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("minutosEspera"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.noOrden}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("noOrden"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.noVoucherTarjeta}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("noVoucherTarjeta"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.propinaTarjeta}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("propinaTarjeta"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.total}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("total"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.totalEfectivo}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("totalEfectivo"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.totalTarjeta}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("totalTarjeta"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.usuarioidUsuario}"), orden1, org.jdesktop.beansbinding.BeanProperty.create("usuarioidUsuario"));
        bindingGroup.addBinding(binding);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.activo}"), detalleorden1, org.jdesktop.beansbinding.BeanProperty.create("activo"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.bebidasIdbebidas}"), detalleorden1, org.jdesktop.beansbinding.BeanProperty.create("bebidasIdbebidas"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.cantidad}"), detalleorden1, org.jdesktop.beansbinding.BeanProperty.create("cantidad"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.descripcion}"), detalleorden1, org.jdesktop.beansbinding.BeanProperty.create("descripcion"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.idDetalleOrden}"), detalleorden1, org.jdesktop.beansbinding.BeanProperty.create("idDetalleOrden"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.idDetalleOrden}"), detalleorden1, org.jdesktop.beansbinding.BeanProperty.create("ordenidOrden"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.platosidPlatos}"), detalleorden1, org.jdesktop.beansbinding.BeanProperty.create("platosidPlatos"));
        bindingGroup.addBinding(binding);

        setBackground(new java.awt.Color(255, 255, 255));
        setClosable(true);
        setIconifiable(true);
        setTitle("Compras");
        setAutoscrolls(true);
        setMaximumSize(new java.awt.Dimension(984, 649));
        setMinimumSize(new java.awt.Dimension(984, 649));
        setPreferredSize(new java.awt.Dimension(984, 649));
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.PAGE_AXIS));

        jPanel1.setBackground(new java.awt.Color(54, 149, 240));
        jPanel1.setMaximumSize(new java.awt.Dimension(2000, 50));
        jPanel1.setMinimumSize(new java.awt.Dimension(246, 50));
        jPanel1.setPreferredSize(new java.awt.Dimension(1000, 50));

        jLabel4.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Comandas");
        jPanel1.add(jLabel4);
        jLabel4.getAccessibleContext().setAccessibleName("Control Comandas");

        getContentPane().add(jPanel1);

        jPanel4.setPreferredSize(new java.awt.Dimension(988, 430));

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setPreferredSize(new java.awt.Dimension(494, 500));

        jLayeredPane3.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, ordenList, Tabla, "");
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fecha}"));
        columnBinding.setColumnName("Fecha");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${noOrden}"));
        columnBinding.setColumnName("No Orden");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${totalEfectivo}"));
        columnBinding.setColumnName("Total Efectivo");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${totalTarjeta}"));
        columnBinding.setColumnName("Total Tarjeta");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${descuento}"));
        columnBinding.setColumnName("Descuento");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${propinaTarjeta}"));
        columnBinding.setColumnName("Propina");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${granTotal}"));
        columnBinding.setColumnName("Total Pagado");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${total}"));
        columnBinding.setColumnName("Total");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${usuarioidUsuario.empleadoidEmpleado.nombre}"));
        columnBinding.setColumnName("Mesero");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        Tabla.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(Tabla);
        if (Tabla.getColumnModel().getColumnCount() > 0) {
            Tabla.getColumnModel().getColumn(0).setResizable(false);
            Tabla.getColumnModel().getColumn(1).setResizable(false);
            Tabla.getColumnModel().getColumn(2).setResizable(false);
            Tabla.getColumnModel().getColumn(3).setResizable(false);
            Tabla.getColumnModel().getColumn(4).setResizable(false);
            Tabla.getColumnModel().getColumn(5).setResizable(false);
            Tabla.getColumnModel().getColumn(6).setResizable(false);
            Tabla.getColumnModel().getColumn(7).setResizable(false);
            Tabla.getColumnModel().getColumn(8).setResizable(false);
        }

        jLayeredPane3.add(jScrollPane2);
        jScrollPane2.setBounds(20, 160, 840, 190);

        txtNoOrden.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        txtNoOrden.setNextFocusableComponent(btnBuscarOrden);
        txtNoOrden.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtNoOrdenKeyTyped(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtNoOrdenKeyReleased(evt);
            }
        });
        jLayeredPane3.add(txtNoOrden);
        txtNoOrden.setBounds(140, 80, 280, 30);

        jLabel20.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel20.setText("<html>A</html>");
        jLayeredPane3.add(jLabel20);
        jLabel20.setBounds(280, 40, 20, 20);

        btnAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/plus-3x.png"))); // NOI18N
        btnAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnAgregar);
        btnAgregar.setBounds(640, 30, 50, 40);

        btnModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/pencil-3x.png"))); // NOI18N
        btnModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnModificar);
        btnModificar.setBounds(710, 30, 50, 40);

        btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/restauranteaplicacion/Ingresos/x-3x.png"))); // NOI18N
        btnEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnEliminar);
        btnEliminar.setBounds(780, 30, 50, 40);

        jLabel19.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel19.setText("FILTRAR COMPRAS POR:");
        jLayeredPane3.add(jLabel19);
        jLabel19.setBounds(20, 10, 169, 17);

        jLabel21.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel21.setText("<html>Detalle</html>");
        jLayeredPane3.add(jLabel21);
        jLabel21.setBounds(20, 350, 90, 20);

        jLabel22.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel22.setText("<html>Numero Orden</html>");
        jLayeredPane3.add(jLabel22);
        jLabel22.setBounds(40, 70, 90, 40);

        dateFecha2.setNextFocusableComponent(btnBuscarFecha);
        dateFecha2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                dateFecha2KeyReleased(evt);
            }
        });
        jLayeredPane3.add(dateFecha2);
        dateFecha2.setBounds(300, 40, 120, 30);

        btnBuscarFecha.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/magnifying-glass-2x.png"))); // NOI18N
        btnBuscarFecha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarFechaActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnBuscarFecha);
        btnBuscarFecha.setBounds(430, 40, 40, 30);

        btnBuscarOrden.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/magnifying-glass-2x.png"))); // NOI18N
        btnBuscarOrden.setNextFocusableComponent(dateFecha2);
        btnBuscarOrden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarOrdenActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnBuscarOrden);
        btnBuscarOrden.setBounds(430, 80, 40, 30);

        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, detalleordenList, jTable1);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${bebidasIdbebidas.nombre}"));
        columnBinding.setColumnName("Bebida");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${platosidPlatos.nombre}"));
        columnBinding.setColumnName("Plato");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${cantidad}"));
        columnBinding.setColumnName("Cantidad");
        columnBinding.setColumnClass(Integer.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${descripcion}"));
        columnBinding.setColumnName("Descripcion");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane1.setViewportView(jTable1);

        jLayeredPane3.add(jScrollPane1);
        jScrollPane1.setBounds(20, 370, 840, 90);

        jLabel23.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel23.setText("<html>Seleccion</html>");
        jLayeredPane3.add(jLabel23);
        jLabel23.setBounds(500, 110, 120, 40);

        btnCancelar.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/circle-x-3x.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCancelar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnCancelar);
        btnCancelar.setBounds(20, 470, 90, 57);

        dateFecha1.setNextFocusableComponent(btnBuscarFecha);
        dateFecha1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                dateFecha1KeyReleased(evt);
            }
        });
        jLayeredPane3.add(dateFecha1);
        dateFecha1.setBounds(140, 40, 130, 30);

        cmMesero.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLayeredPane3.add(cmMesero);
        cmMesero.setBounds(140, 120, 280, 30);

        btnBuscarMesero.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/magnifying-glass-2x.png"))); // NOI18N
        btnBuscarMesero.setNextFocusableComponent(dateFecha2);
        btnBuscarMesero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarMeseroActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnBuscarMesero);
        btnBuscarMesero.setBounds(430, 120, 40, 30);

        jLabel25.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel25.setText("Efectivo");
        jLayeredPane3.add(jLabel25);
        jLabel25.setBounds(280, 470, 70, 20);

        lbTotal.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        lbTotal.setText("0.00");
        jLayeredPane3.add(lbTotal);
        lbTotal.setBounds(660, 490, 50, 40);

        lbPropina.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        lbPropina.setText("0.00");
        jLayeredPane3.add(lbPropina);
        lbPropina.setBounds(510, 490, 60, 40);

        jLabel28.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel28.setText("<html>Totales</html>");
        jLayeredPane3.add(jLabel28);
        jLabel28.setBounds(200, 460, 90, 40);

        jLabel26.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel26.setText("<html>Fecha</html>");
        jLayeredPane3.add(jLabel26);
        jLabel26.setBounds(40, 30, 90, 40);

        jLabel27.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel27.setText("Tarjeta");
        jLayeredPane3.add(jLabel27);
        jLabel27.setBounds(390, 470, 70, 20);

        jLabel29.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel29.setText("Total");
        jLayeredPane3.add(jLabel29);
        jLabel29.setBounds(660, 470, 70, 20);

        lbTarjeta.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        lbTarjeta.setText("0.00");
        jLayeredPane3.add(lbTarjeta);
        lbTarjeta.setBounds(390, 490, 60, 40);

        jLabel30.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel30.setText("Propina");
        jLayeredPane3.add(jLabel30);
        jLabel30.setBounds(510, 470, 70, 20);

        lbEfectivo.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        lbEfectivo.setText("0.00");
        jLayeredPane3.add(lbEfectivo);
        lbEfectivo.setBounds(280, 490, 60, 40);

        cmbSeleccion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todos", "Desayunos", "Almuerzos" }));
        jLayeredPane3.add(cmbSeleccion);
        cmbSeleccion.setBounds(620, 110, 180, 27);

        jLabel24.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel24.setText("<html>Nombre Mesero </html>");
        jLayeredPane3.add(jLabel24);
        jLabel24.setBounds(40, 110, 90, 40);

        btnCancelar1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        btnCancelar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/circle-check-3x.png"))); // NOI18N
        btnCancelar1.setText("Imprimir");
        btnCancelar1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCancelar1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCancelar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelar1ActionPerformed(evt);
            }
        });
        jLayeredPane3.add(btnCancelar1);
        btnCancelar1.setBounds(770, 470, 90, 57);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jLayeredPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 902, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(41, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLayeredPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 968, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 569, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 33, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel4);

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

  
    
    
    private void CargarTablaDetalle(List<Detalleorden> listatemp){
        detalleordenList.clear();
        agregarListaDetalle(detalleordenList,listatemp);
    }
    
    private void cargarMeseros()
    {
        List<Usuarios> lista = CNUsuarios.buscarMeseros(1);
        if(lista!=null)
            for(Usuarios temp : lista)
                cmMesero.addItem(new ComboBox(temp.getIdUsuarios(),temp.getEmpleadoidEmpleado().getNombre()));
    }
    
    private void buscar()
    {
        ComboBox combo = (ComboBox) cmMesero.getSelectedItem();
        List<Orden> lista = CNOrden.buscarParametros(dateFecha1.getDate(), dateFecha2.getDate(), combo.getId(), txtNoOrden.getText());
        ordenList.clear();
        agregarLista(ordenList, lista);
        lista=ordenList;
        float p=0,x=0,e=0,t=0;
        if(lista!=null)
        {
            for(Orden te : lista)//Ciclo para realizar la Sumatorias
            {
                if(te.getPropinaTarjeta()!=null)
                    p=p+ te.getPropinaTarjeta();
                if(te.getTotal()!=null)
                    x=x+ te.getTotal();
                if(te.getTotalEfectivo()!=null)
                    e=e+te.getTotalEfectivo();
                if(te.getTotalTarjeta()!=null)
                    t=t+te.getTotalTarjeta();
            }            
        }
        lbPropina.setText(String.valueOf(p));
        lbTotal.setText(String.valueOf(x));
        lbEfectivo.setText(String.valueOf(e));
        lbTarjeta.setText(String.valueOf(t));
    }
    
    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
        // TODO add your handling code here:
        int fila =0;
        if(Tabla.getSelectedRow()>=0)
        {
            fila = JOptionPane.showInternalConfirmDialog(this, "Desea Eliminar "
                + " la orden", "Confirmacion",1, 0);
            if(fila == JOptionPane.OK_OPTION)
            {                
                if(CNOrden.eliminarConDescuento(orden1))
                {
                    ordenList.remove(orden1);
                    detalleordenList.clear();
                    JOptionPane.showMessageDialog(this, "Se elimino Correctamente", 
                        "Informacion", JOptionPane.INFORMATION_MESSAGE);
                }
                else
                    JOptionPane.showMessageDialog(this, "No se ha podido Eliminar", 
                    "Informacion", JOptionPane.INFORMATION_MESSAGE);
            }
        }
        else
            JOptionPane.showMessageDialog(this, "Debe de Seleccionar un elemento", 
                    "Informacion", JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_btnEliminarActionPerformed

  
    
    private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed
        //TODO add your handling code here:  
       if(Tabla.getSelectedRow()>= 0)
       {
           /*IngresoCompras ing = new IngresoCompras(obs, ordenentrada1);
           MDI.getDesktopPane().add(ing);
           ing.show();
           obs.addObserver(ing);
           Desactivar();*/
           
       }
        
    }//GEN-LAST:event_btnModificarActionPerformed

    private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
        // TODO add your handling code here:
        IngresoPagos ing = new IngresoPagos(obs);
        MDI.getDesktopPane().add(ing);
        ing.show();
        //obs.addObserver(ing);
        Desactivar();
    }//GEN-LAST:event_btnAgregarActionPerformed

    private void TablaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaMouseClicked
        // TODO add your handling code here:
        //int fila = Tabla.rowAtPoint(evt.getPoint());
        //proveedores1 =proveedorList.get(fila);
        if(orden1!=null)
        {
            if(orden1.getDetalleordenCollection()!=null)
            CargarTablaDetalle((List)orden1.getDetalleordenCollection());
        }
    }//GEN-LAST:event_TablaMouseClicked

    private void btnBuscarFechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarFechaActionPerformed
        // TODO add your handling code here:
        buscar();
        //buscarDatos();
    }//GEN-LAST:event_btnBuscarFechaActionPerformed

    private void btnBuscarOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarOrdenActionPerformed
        // TODO add your handling code here:
        buscar();
    }//GEN-LAST:event_btnBuscarOrdenActionPerformed

    private void txtNoOrdenKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNoOrdenKeyReleased
        // TODO add your handling code here:
        if(evt.getKeyCode() == KeyEvent.VK_ENTER)
            buscar();
    }//GEN-LAST:event_txtNoOrdenKeyReleased

    private void dateFecha2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_dateFecha2KeyReleased
        // TODO add your handling code here:
        if(evt.getKeyCode() == KeyEvent.VK_ENTER)
            buscarDatos();
    }//GEN-LAST:event_dateFecha2KeyReleased

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed

        this.setVisible(false);
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void dateFecha1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_dateFecha1KeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_dateFecha1KeyReleased

    private void btnBuscarMeseroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarMeseroActionPerformed
        // TODO add your handling code here:
        buscar();
    }//GEN-LAST:event_btnBuscarMeseroActionPerformed

    private void txtNoOrdenKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNoOrdenKeyTyped
        // TODO add your handling code here:
        char c=evt.getKeyChar();
        if((!Character.isDigit(c))) {
            getToolkit().beep();
            evt.consume();
        }
    }//GEN-LAST:event_txtNoOrdenKeyTyped
 
    private List preparaLista()
    {
        List<CorteDelDia> lista = new ArrayList<CorteDelDia>();
        List<Usuarios> tempMesero = CNUsuarios.buscarActivos();
        for(Usuarios us : tempMesero)
        {
            CorteDelDia cort = new CorteDelDia();
            cort.setMesero(us.getUserName());
            cort.setFecha(dateFecha1.getDate());
            lista.add(cort);
        }
        for(Orden temp :ordenList )
        {
            int x =-1;
            x=lista.lastIndexOf(new CorteDelDia(temp.getUsuarioidUsuario().getUserName()));
            if(x!=-1)
            {
                lista.get(x).setEfectivo(temp.getTotalEfectivo());
                lista.get(x).setPropina(temp.getPropinaTarjeta());
                lista.get(x).setTarjeta(temp.getTotalTarjeta());
                lista.get(x).setTotal(temp.getGranTotal());
            }
        }
        
        return lista;
    }
    
    private void btnCancelar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelar1ActionPerformed
        // TODO add your handling code here:
        if(ordenList.isEmpty())
        {
            JOptionPane.showMessageDialog(this, "No se ha realizado busquedas", 
                    "Informacion", JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Map<String, Object> parametros = new HashMap<String, Object>();
        parametros.put("totales", lbTotal.getText());
        parametros.put("efectivos", lbEfectivo.getText());
        parametros.put("tarjetas", lbTarjeta.getText());
        String caja = JOptionPane.showInputDialog("Ingresar Inicio de Caja: ", "0");
        String gasto = JOptionPane.showInputDialog("Ingresar Gastos: ", "0");
        if(caja == null || Float.isNaN(Float.parseFloat(caja)))
            caja ="0.0";
        if(gasto == null || Float.isNaN(Float.parseFloat(gasto)))
            gasto = "0.0";
        Float temp1 = Float.parseFloat(gasto);
        Float temp2 = Float.parseFloat(caja);
        Float total = Float.parseFloat(lbTotal.getText()) -
                Float.parseFloat(lbTarjeta.getText()) -
                temp1 + temp2;
        parametros.put("granTotal", total.toString());
        parametros.put("caja", caja);
        parametros.put("gasto", gasto);
        JRBeanCollectionDataSource jbean = new JRBeanCollectionDataSource(preparaLista());     
        try {
            //JasperReport js= (JasperReport) JRLoader.loadObject("report1.jasper");
            URL hi =getClass().getResource("/Reportes/CorteDelDia.jasper");
            JasperReport report  = (JasperReport)JRLoader.loadObject(hi);
            JasperPrint jaserPrint = JasperFillManager.fillReport(report, parametros, jbean);
            JasperViewer jviewer = new JasperViewer(jaserPrint,false);
            //Le damos un título al reporte.
            jviewer.setTitle("Lista de Tipos de Artículos.");
            //La hacemos visible.
            jviewer.setVisible(true);
            //JRExporter exporter = new JRPdfExporter();  
            //exporter.setParameter(JRExporterParameter.JASPER_PRINT, jaserPrint); 
            //exporter.setParameter(JRExporterParameter.OUTPUT_FILE, new java.io.File("reporte2PDF.pdf")); 
            //exporter.exportReport();
        } catch (JRException ex) {
            
            System.out.println(ex.toString());
            JOptionPane.showMessageDialog(this, ex.toString(), 
                    "Informacion", JOptionPane.INFORMATION_MESSAGE);
        }
        catch(Exception e)
        {
            System.out.println(e.toString());
            JOptionPane.showMessageDialog(this, e.toString(), 
                    "Informacion", JOptionPane.INFORMATION_MESSAGE);
        }
        
        
       /*String cadena = "Efectivo "+lbEfectivo.getText()+"\r\nTarjeta "+lbTarjeta.getText()+"\nPropina " + 
                lbPropina.getText() + "\nTotal "+ lbTotal.getText();
	if (!cadena.equals(""))
        {
                Impresora imp = new Impresora();
                imp.imprimir(cadena);
        }

        else System.out.println("NO SE IMPRIME NADA EN BLANCO...");*/
    }//GEN-LAST:event_btnCancelar1ActionPerformed
   
    public void buscarDatos()
    {
        boolean b=false,c=false;
        if(!txtNoOrden.getText().equals(""))
            b=true;
        if(dateFecha2.getDate()!=null)
            c=true;
        if (c&&b){
            //CargarTabla(CNOrdenEntrada.buscarFacturaFecha(txtFactura.getText(),jDateChooser.getDate()));
            return;
        }        
        //if(b)
        //    CargarTabla(CNOrdenEntrada.buscarFactura(txtFactura.getText()));
        //if(c)
        //    CargarTabla(CNOrdenEntrada.buscarFecha(jDateChooser.getDate()));
        
    }
    
    public void agregarListaDetalle(List lista, List nuevaLista)
    {
        if(nuevaLista!=null)
        {
            Iterator<?> ite = nuevaLista.iterator();
            while(ite.hasNext())
            {
                lista.add(ite.next());
            }
        }
    }
    
    public void agregarLista(List lista, List nuevaLista)
    {
       if(nuevaLista!= null)
        {
            Iterator<?> ite = nuevaLista.iterator();
            while(ite.hasNext())
            {
                Orden ord= (Orden) ite.next();
                if(cmbSeleccion.getSelectedIndex()==0)
                    lista.add(ord);
                if(cmbSeleccion.getSelectedIndex()==1)
                {
                    if(verificarPlatoDesayuno(ord)==true)
                        lista.add(ord);
                }
                if(cmbSeleccion.getSelectedIndex()==2)
                {
                    if(verificarPlatoDesayuno(ord)==false)
                        lista.add(ord);
                }
                    
            }
        }
        
    }
    
    public boolean verificarPlatoDesayuno(Orden com)
    {
        if(com.getDetalleordenCollection()==null)
            return false;
        for(Detalleorden det : com.getDetalleordenCollection())
        {
            if(det.getPlatosidPlatos()!=null)
            {
                if(det.getPlatosidPlatos().getClasificacionidClasificacion().getIdClasificacion()==8)
                {
                    return true;
                }
            }
        }
        return false;
    }
            
    private void Desactivar()
    {
        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
        for(Component x :this.jPanel2.getComponents())
            x.setEnabled(false);
        Tabla.setEnabled(false);
        for(Component x : this.jLayeredPane3.getComponents())
            x.setEnabled(false);
    }
    private void Activar()
    {
        this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        for(Component x :this.jPanel2.getComponents())
            x.setEnabled(true);
        Tabla.setEnabled(true);
        for(Component x : this.jLayeredPane3.getComponents())
            x.setEnabled(true);
        
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable Tabla;
    private javax.swing.JButton btnAgregar;
    private javax.swing.JButton btnBuscarFecha;
    private javax.swing.JButton btnBuscarMesero;
    private javax.swing.JButton btnBuscarOrden;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnCancelar1;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnModificar;
    private javax.swing.JComboBox cmMesero;
    private javax.swing.JComboBox cmbSeleccion;
    private com.toedter.calendar.JDateChooser dateFecha1;
    private com.toedter.calendar.JDateChooser dateFecha2;
    private entidad.Detalleorden detalleorden1;
    private java.util.List<entidad.Detalleorden> detalleordenList;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLayeredPane jLayeredPane3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JLabel lbEfectivo;
    private javax.swing.JLabel lbPropina;
    private javax.swing.JLabel lbTarjeta;
    private javax.swing.JLabel lbTotal;
    private entidad.Orden orden1;
    private java.util.List<entidad.Orden> ordenList;
    private javax.swing.JTextField txtNoOrden;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

    @Override
    public void update(Observable o, Object arg) {
       Activar();
       //CargarTabla(CNOrdenEntrada.buscarNombre(txtNombre.getText()));
       
    }

    @Override
    public void run() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        Desactivar();
        //buscar();
        Activar();
    }
}
